<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = [2, 1, 7, 3, 4]
      var s = 0
      for (var i = 0; i < arr.length; i++) {
        s += arr[i]
      }
      console.log(s, s / arr.length)
    </script>
  </body>
</html>
